package cn.juque.systemservice.task;

import cn.juque.systemservice.cache.AreaInfoCache;
import cn.juque.systemservice.cache.GenInfoCache;
import cn.juque.systemservice.cache.OrgCache;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author juque
 * @version 1.0.0
 * <ul>
 *     <li>LocalCacheTask</li>
 * </ul>
 * @date 2023-03-03 22:51:32
 **/
@Component("localCacheTask")
public class LocalCacheTask {

    @Resource
    private AreaInfoCache areaInfoCache;

    @Resource
    private OrgCache orgCache;

    @Resource
    private GenInfoCache genInfoCache;

    @Async("systemserviceExecutor")
    public void execute(){
        this.areaInfoCache.refreshTree();
        this.orgCache.loadOrg();
        this.genInfoCache.refresh();
    }
}
